Text-to-speech API

Implement the text-to-speech (TTS) API to act as a TTS provider for Live Hub, whether for a synthesis service of your own or for a vendor Live Hub does not integrate with directly. Live Hub is the client: it posts the text it wants spoken, and your service returns the audio.

Register the service as a custom integration speech provider, and enter your endpoint in the 'Text to Speech (TTS) URL' field.

Authentication

Live Hub sends the shared token from the provider's 'Authentication Key' field on every request:

Authorization: Bearer {token}

See Security and authentication.

Request

Live Hub posts a JSON body with these attributes:

Parameter Type Description
text string The text to synthesize.
type string Set to ssml when text contains SSML.
voice string Name of the voice to synthesize with.
language string BCP-47 language code of the text to synthesize.
format string Whether to return the audio with headers: wav with WAV headers, raw without. Follows the ttsPreferWave parameter.
encoding string The encoding to synthesize in. Only 16-bit linear PCM, LINEAR16, is supported.
sampleRateHz number The sample rate to synthesize at, in hertz. Only 16000 is supported.
conversationId string ID of the conversation the request belongs to.
{
  "language": "en-US",
  "format": "wav",
  "encoding": "LINEAR16",
  "sampleRateHz": 16000,
  "voice": "SomeVoiceName",
  "text": "Text to be played"
}

With SSML, set type and put the markup in text:

{
  "language": "en-US",
  "format": "wav",
  "encoding": "LINEAR16",
  "sampleRateHz": 16000,
  "voice": "SomeVoiceName",
  "type": "ssml",
  "text": "<speak><say-as interpret-as=\"ordinal\">1</say-as></speak>"
}

Response

Return 200 OK with the synthesized speech as the body. On failure, return an HTTP error code.

Configuration

One parameter controls the audio format Live Hub requests:

Parameter Type Description
ttsPreferWave boolean Which audio format Live Hub asks for in format. true (default) requests WAV, with a header. false requests RAW, without one. Applies to this API only.